﻿namespace Iterator
{
    internal class BookShelflterator : IIterator
    {
        public bool HasNext()
        {
            if (index < bookShelf.GetLength()) 
            {
                return true;
            }
            return false;
        }

        public object Next()
        {
            var book = this.bookShelf.GetBookAt(index);
            index++;
            return book;
        }

        private BookShelf bookShelf;
        private int index;
        public BookShelflterator(BookShelf bookShelf) 
        {
            this.bookShelf = bookShelf;
            this.index = 0;
        }

    }
}
